<template>
	<div class="box">
		 <!--v-if="arraydata.length>0"-->
		<HomeProductItem :cateList="arraydata" page="newPage"></HomeProductItem>
		<!--<div v-if="list.length==0 && env === 'edit'" style="height: 2.5rem;line-height: 2.5rem;">请配置数据</div>-->
	</div>
</template>

<script>
	import HomeProductItem from "../../../real-components/HomeProductItem";
	import { mapGetters, mapMutations } from "vuex";
	import { getPageTree, initDomTree } from "../../../utils/getPageTree";
	import axios from "axios";
	export default {
		props: {
			list: {
				type: Array,
				default: () => []
			}
		},
		data() {
			return {
				msg: '这是首页',
				page: "home",
				arraydata: [],
			}
		},
		computed: {
			...mapGetters([
				"getDomTree"
			]),
			pageTree() {
				return getPageTree(this, this.page);
			},
			env() {
				return window.environment; // 获取是否是编辑状态
			},
		},
		components: {
			HomeProductItem,
		},
		methods: {
			...mapMutations('xxy', [
				"setseeall",
			]),
			tendata() {
				this.arraydata = []
				let length = this.list.length < 10 ? this.list.length : 10
				for(var i = 0; i < length; i++) {
					this.arraydata.push(this.list[i])
				}
			}
		},
		watch: {
			list(data) {
				this.tendata()
			}
		},
		created() {
			this.setseeall(true)
		},
		mounted() {
			// initDomTree(this.getDomTree[this.page]);
			this.tendata()
		},
		updated() {
			//页面更新完毕
			// initDomTree(this.getDomTree[this.page]);
		}
	}
</script>

<style>

</style>